using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using PadnugService;
using padnug.Domain;
namespace padnug.Controllers
{
    public class JsonController : Controller
    {
        private PadnugEventsService svc;

        public JsonController()
        {
            svc = new PadnugEventsService();
        }

        public ActionResult Index()
        {
            return View();
        }

        public ActionResult EventDates(DateTime firstDayOfMonh)
        {
            var eventDates = svc.GetEventsForMonth(firstDayOfMonh);
            IList<string> dateStrings = new List<string>();
            foreach (var date in eventDates)
            {
                var dateStr = date.ToShortDateString();
                dateStrings.Add(dateStr);
            }
            return Json(dateStrings.ToArray());
        }

    }
}
